﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class user_MasterPage2 : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //this.Label1.Text = Session["id"]+"，欢迎您！";
        String strConnection = "server=.;database=keshe2;Integrated Security=SSPI";
        SqlConnection connection = new SqlConnection(strConnection);
        connection.Open();
        if (Session["id"] != null)
        {
            String strSQL = "Select * From 客户 WHERE 客户编号" + "=" + Session["id"];
            SqlCommand command = new SqlCommand(strSQL, connection);
            SqlDataReader Dr = command.ExecuteReader();
            try
            {
                while (Dr.Read())
                {
                    DateTime time = DateTime.Today;
                    string time1 = time.Year.ToString() + "年" + time.Month.ToString() + "月" + time.Day.ToString() + "日" + " " + System.Globalization.CultureInfo.GetCultureInfo("zh-CN").DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
                    this.Label1.Text = Dr["客户名"] + "，欢迎您！" + "当前时间：" + time1;
                }
            }
            catch (SqlException ex)
            {
                Response.Write(ex.Message.ToString());
            }
            finally
            {
                Dr.Close();
            }
        }
        //DateTime time = DateTime.Today;
       // string time1 = time.Year.ToString() + "年" + time.Month.ToString() + "月" + time.Day.ToString() + "日" + " " + System.Globalization.CultureInfo.GetCultureInfo("zh-CN").DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
       // this.Label1.Text = Session["客户名"] + "，欢迎您！" + "当前时间：" + time1;
    }
        
    }
